import mindspore


def CustomDataLoader_testing_data(transform, batch_size):
    test_data = mindspore.dataset.Cifar10Dataset(dataset_dir='data', usage=False).map(operations=transform).batch(drop_remainder=True).shuffle(buffer_size=True)
    return test_data


def CustomDataLoader_training_data(transform, batch_size):
    train_data = mindspore.dataset.Cifar10Dataset(dataset_dir='data', usage=True).map(operations=transform).batch(drop_remainder=True).shuffle(buffer_size=True)
    return train_data


transform = mindspore.dataset.transforms.Compose([mindspore.dataset.vision.ToTensor(), mindspore.dataset.vision.Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])])
batch_size = 64
train_data = CustomDataLoader_training_data(transform, batch_size)
test_data = CustomDataLoader_testing_data(transform, batch_size)